# Newbie's Practice Code for Compiler (language lox)

## Create New Project

### Maven
The use of env command just because I have many jdk version installed,
and the default one is pretty old (but lots of software ***still*** required this ancient version),
so if you didn't encounter this same situtation, just use mvn command instead.

```bash
env JAVA_HOME="/usr/lib64/openjdk-17/" \
  mvn archetype:generate \
  -DgroupId=lox \
  -DartifactId=craftinginterpreters
```

After project created, set compiler version to 17 and then add exec-maven-plugin to plugin section:

```xml
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>3.0.0</version>
  <configuration>
    <mainClass>lox.App</mainClass>
  </configuration>
</plugin>
```

### Environments
Learn it from python's venv, using one single file (bin/activate) to controll
all the environments of this project.

```bash
source bin/activate
```

### Makefile
Not necessary, but mvn's command is too complex, so I decided write this to simplify the build/run process.


## References:
1. https://craftinginterpreters.com
